package cn.itlaobing.service.Impl;

import cn.itlaobing.entity.EmployeeModel;
import cn.itlaobing.mapper.EmployeeModelMapper;
import cn.itlaobing.service.EmployService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Administrator on 2017-12-02.
 */
@Service
public class EmployServiceImpl implements EmployService {
    @Autowired
    private EmployeeModelMapper employeeModelMapper;
    @Override
    public EmployeeModel findByid(Integer id) {
        return employeeModelMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<EmployeeModel> queryAll() {

        return employeeModelMapper.QueryAll();
    }

    @Override
    public EmployeeModel updateEmployee(EmployeeModel employeeModel) {
        employeeModelMapper.updateByPrimaryKeySelective(employeeModel);
        return employeeModel;
    }

    @Override
    public int deleteEmployByid(Integer id) {
        return employeeModelMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int addEmploy(EmployeeModel employeeModel) {
        return employeeModelMapper.insert(employeeModel);
    }
}
